<%--
  Created by IntelliJ IDEA.
  User: lujw
  Date: 2017/6/18
  Time: 10:07
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/common/hospital_token.jsp"%>
<%
    //院内版意见反馈
    HospitalFeedback feedback = HospitalFeedback.fromMap(parameters, HospitalFeedback.class);
    List imgList = new ArrayList();
    if (Objects.nonNull(feedback.getImg()) && !"".equals(feedback.getImg()))
        imgList = Arrays.asList(feedback.getImg().split("\\|"));
    feedback.setImg(JSONUtil.toJson(imgList));
    feedback.setUid(token.getUid());
    String suggestion = input.getDesc("suggestion", "");
    if (suggestion.isEmpty()) {
        msg.setErrcodeAndErrmsg(ErrcodeUtil.FAILURE, "请输入反馈内容");
        Tools.encryptPrint(out, msg);
        return;
    }
    if (suggestion.length() > 400) {
        msg.setErrcodeAndErrmsg(ErrcodeUtil.FAILURE, "很抱歉，您只能输入400个字");
        Tools.encryptPrint(out, msg);
        return;
    }
    Integer id = (Integer)DBTools.db("basedb").addItem(feedback);
    if (id == null) {
        msg = new Message(30002, "反馈失败");
        Tools.encryptPrint(out, msg);
        return;
    }
    msg.setErrmsg("感谢您的反馈");
    Tools.encryptPrint(out, msg);
%>
